<%--
  Created by IntelliJ IDEA.
  User: Lanan
  Date: 2017/12/18 0018
  Time: 14:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<html>
<head>
    <%@ include file="/commons/basejs.jsp" %>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>用户资金流水</title>
</head>
<body>
<!-- 数据表格 begin -->
<table id="user_capital_flow" title="用户资金流水列表" class="easyui-datagrid"
       data-options="
   		url:'${path}/user/capital/flow/list.do',
		fit:true,
		idField:'id',
		rownumbers:true,
		toolbar:'#tools',
		loadMsg:'正在处理，请等待......',
		pagination:true,
		fitColumns:true,
		singleSelect:true,
		nowrap:false,
   		">
    <thead>
        <th data-options="field:'id', align:'center'">ID</th>
        <th data-options="field:'userName', align:'center'">用户名</th>
        <th data-options="field:'userPhone', align:'center'">用户电话</th>
        <th data-options="field:'userEmail', align:'center'">Email</th>
        <th data-options="field:'type', align:'center', formatter:formatterMoneyType">流水类型</th>
        <th data-options="field:'typeName', align:'center'">流水类型名</th>
        <th data-options="field:'val', align:'center'">流水值</th>
        <th data-options="field:'orderNo', align:'center'">产品订单号</th>
        <th data-options="field:'orderProductNo', align:'center'">产品订单产品号</th>
        <th data-options="field:'rechargeOrderNo', align:'center'">充值订单号</th>
        <th data-options="field:'createTime', align:'center', formatter:formatDatebox">操作时间</th>
    </thead>
</table>
<div id="tools">
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="refreshUserCapitalFlowList()">刷新</a>
    <label>用户:</label>
    <div style="position: relative;height:15px;width:170px;top:2px; display:inline-block;">
        <input type="text" name="searchUserInfo" id="searchUserInfo" value="" hidden/>
        <input type="text" id="autocomplete-ajax-search" style="position: absolute; z-index: 2; background: transparent;"/>
        <input type="text" id="autocomplete-ajax-search-x" disabled="disabled" style="color: #CCC; position: absolute; background: transparent; z-index: 1;"/>
    </div>
    <label>类型:</label>
    <select id="typeSearchWord" name="typeSearchWord" class="easyui-combobox" data-options="width:'100px', editable:false, panelHeight:'auto'">
        <option value="">全部</option>
        <option value="0">充值</option>
        <option value="1">扣款</option>
        <option value="2">提现</option>
        <option value="3">删除</option>
        <option value="4">支付宝支付</option>
        <option value="5">微信支付</option>
        <option value="6">余额支付</option>
    </select>
    <label>订单号:</label>
    <input class="easyui-textbox" id="searchCapitalFlowAboutNo" data-options="prompt:'请输入搜索订单号'"/>
    <label>开始时间</label>
    <input id="searchStartTemp" name="searchStartTemp" type="text" class="easyui-datebox">
    <label>结束时间</label>
    <input id="searchEndTemp" name="searchEndTemp" type="text" class="easyui-datebox">
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchUserCapitalFlow()">搜索</a>
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear'" onclick="searchUserCapitalFlowReset()">重置</a>
</div>
<!-- 数据表格 end -->


<script type="text/javascript">
    $(function () {
        autoCompleteDate('${path}/user/address/autoCompleteData.do', 'autocomplete-ajax-search', 'searchUserInfo', 'autocomplete-ajax-search-x');
    })

    function refreshUserCapitalFlowList() {
        $("#user_capital_flow").datagrid("reload");
    }

    function searchUserCapitalFlow() {
        var queryParams = {};
        queryParams.userId = $("#searchUserInfo").val();
        queryParams.number = $("#searchCapitalFlowAboutNo").textbox("getValue");
        queryParams.type = $("#typeSearchWord").combobox('getValue');
        var searchStartTemp = $("#searchStartTemp").datebox("getValue");
        var searchEndTemp = $("#searchEndTemp").datebox("getValue");
        if (searchEndTemp != null || searchEndTemp == null) {
            if (searchEndTemp != null && searchEndTemp != "" && !checkDate(searchEndTemp, "结束时间格式错误")) {
                return;
            }
            if (searchStartTemp != null && searchStartTemp != "" && !checkDate(searchStartTemp, "开始时间格式错误")) {
                return;
            }
            if (searchEndTemp != null && searchEndTemp != "" && searchEndTemp < searchStartTemp) {
                $.messager.alert("提示","结束时间不能小于开始时间！","info");
                return;
            }
            queryParams.searchStartTemp = searchStartTemp;
            queryParams.searchEndTemp = searchEndTemp;
        }
        $("#user_capital_flow").datagrid('options').queryParams = queryParams;
        $("#user_capital_flow").datagrid('getPager').data("pagination").options.pageNumber = 1;
        $("#user_capital_flow").datagrid('reload');
    }

    function searchUserCapitalFlowReset() {
        $("#searchUserInfo").val("");
        $('#autocomplete-ajax-search').val("");
        $("#searchCapitalFlowAboutNo").textbox("setValue", "");
        $("#searchStartTemp").datebox('setValue', "");
        $("#searchEndTemp").datebox('setValue', "");
        $("#typeSearchWord").combobox('setValue', "");
    }
</script>

</body>
</html>
